Imports ToolKitVB
Imports ToolKitVB.Web.UI.Javascript
Imports System.ComponentModel
Imports System.Web.UI

<Bindable(True), _
 System.Drawing.ToolboxBitmap(GetType(ToolKitCheckBox), _
"Web.UI.WebControls.CheckBox.ico")> _
Public Class ToolKitCheckBox
    Inherits WebControls.CheckBox
    Implements IToolKit
    Public Sub New()
        MyBase.New()
    End Sub
    Private _AddToJavascript As Boolean = False
    ''' <summary>
    ''' Makes TextBox Available in AddToJavascript.
    ''' </summary>
    ''' <remarks></remarks>
    Public Property AddToJavascript() As Boolean
        Get
            Return _AddToJavascript
        End Get
        Set(ByVal value As Boolean)
            _AddToJavascript = value
        End Set
    End Property
    Private _OnClientClick As String = ""
    Public Property OnClientClick() As String
        Get
            Return _OnClientClick
        End Get
        Set(ByVal value As String)
            _OnClientClick = value
        End Set
    End Property
    Public Property ToolKitPage() As Web.UI.ToolKitPage
        Get
            Return DirectCast(MyBase.Page, Web.UI.ToolKitPage)
        End Get
        Set(ByVal value As Web.UI.ToolKitPage)
            MyBase.Page = value
        End Set
    End Property
    Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
        MyBase.OnPreRender(e)
        If _AddToJavascript Then
            Me.ToolKitPage.Javascript.RegisterControl(Me)
        End If
        If _OnClientClick <> "" Then Me.Attributes.Add("onclick", ToolKitTools.WrapErrorHandler(_OnClientClick, Me.ID & " OnClientClick"))
    End Sub
    Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
        MyBase.Render(writer)
    End Sub
    Protected Overrides Sub OnDataBinding(ByVal e As System.EventArgs)
        MyBase.OnDataBinding(e)
    End Sub
    Public Overrides Function ToString() As String Implements IToolKit.ToString
        Return Me.Checked.ToString
    End Function
End Class
